import java.util.List;

/**
 * 节点
 *
 * @author yezhiqiu
 * @date 2021/08/16
 */
public class ListNode {

    public int val;

    public ListNode next;

    public ListNode(int val) {
        this.val = val;
    }

    public ListNode(int val, ListNode next) {
        this.val = val;
        this.next = next;
    }

    public static ListNode init(List<Integer> list) {
        ListNode dummy = new ListNode(-1);
        ListNode cur = dummy;
        for (Integer val : list) {
            cur.next = new ListNode(val);
            cur = cur.next;
        }
        return dummy.next;
    }


}
